package com.wolf.vo;

import com.alibaba.fastjson.JSONArray;
import com.wolf.provider.order.info.PageInfo;

/**
 * @author sdyang
 * @date 2019/10/3 9:22
 **/
public class PageResult<T> {

    private Integer draw;

    private Integer recordsTotal;

    private Integer recordsFiltered;

    private Object data;

    public PageResult() {
        this.recordsTotal = 0;
        this.recordsFiltered = 0;
        this.data = new JSONArray();
    }

    public void buildResult(PageInfo<T> t) {
        if (t == null) {
            return;
        }
        this.recordsFiltered = t.getPageBean().getTotalCount();
        this.recordsTotal = t.getPageBean().getTotalCount();
        this.data = t.getRecordList();
    }

    public Integer getRecordsTotal() {
        return recordsTotal;
    }

    public void setRecordsTotal(Integer recordsTotal) {
        this.recordsTotal = recordsTotal;
    }

    public Integer getRecordsFiltered() {
        return recordsFiltered;
    }

    public void setRecordsFiltered(Integer recordsFiltered) {
        this.recordsFiltered = recordsFiltered;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getDraw() {
        return draw;
    }

    public void setDraw(Integer draw) {
        this.draw = draw;
    }
}
